package day_2022_9_to_12.Day;

import java.util.Arrays;

/**
 * @author haomin
 * @date 2022/09/03 09:40
 **/
public class Day1_1_Num646_FindLongestChain {
    class Solution {
        public int findLongestChain(int[][] pairs) {
            int minValue = Integer.MIN_VALUE, res = 0;
            Arrays.sort(pairs,(a, b)-> a[1]-b[1]);
            for(int[] p : pairs){
                if(minValue < p[0]){
                    minValue = p[1];
                    res++;
                }
            }
            return res;
        }
    }
}